from appium.webdriver.common.mobileby import MobileBy as By
from pages.base_page import BasePage

class ShequPage(BasePage):
    #社区定位器
    sqdj_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    #社区最新定位器
    sqzx_locator = (By.XPATH,'//android.widget.TextView[@text=\"最新\"]')

    def sqdj(self):
        self.driver.find_element(*self.sqdj_locator).click()
    def sqzx(self):
        self.driver.find_element(*self.sqzx_locator).click()

    #断言成功跳转至社区最新页面
    sqzxym_locator = (By.XPATH,'//android.widget.TextView[@text=\"最新\"]')
    def get_sqzxym(self):
        ''''跳转至最新页面'''
        sqzxym = self.find_element(self.sqzxym_locator).text
        return sqzxym







    #验证查看关注
    #点击社区
    sqgz_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    #社区关注
    sqgzdj_locator = (By.XPATH,'//android.widget.TextView[@text=\"关注\"]')

    def sqgz(self):
        self.driver.find_element(*self.sqgz_locator).click()
    def sqgzdj(self):
        self.driver.find_element(*self.sqgzdj_locator).click()

    #断言成功跳转关注页面
    sqgzym_locator = (By.XPATH,'//android.widget.TextView[@text=\"关注\"]')
    def get_sqgzym(self):
        '''跳转至关注页面'''
        sqgzym = self.find_element(self. sqgzym_locator).text
        return sqgzym






    #验证社区精选评论博主!!!!!!!!!!!!!!!!
    #点击社区
    plqz_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    #点击社区精选
    jrsqjx_locator = (By.ID,'com.gfeng.daydaycook:id/account_tv')
    #点击评论按钮
    plbz_locator = (By.XPATH,'//android.widget.TextView[@resource-id=\"com.gfeng.daydaycook:id/tv_comment\"]')
    #点击发送按钮
    fspl_locator = (By.XPATH,'//android.widget.TextView[@resource-id=\"com.gfeng.daydaycook:id/tv_commit\"]')

    def plqz(self):
        self.driver.find_element(*self.plqz_locator).click()
    def jrsqjx(self):
        self.driver.find_element(*self.jrsqjx_locator).click()
    def plbz(self,plnr):
        self.driver.find_element(*self.plbz_locator).send_keys(plnr)
    def fspl(self):
        self.driver.find_element(*self.fspl_locator).click()

    #断言评论成功
    plcg_locator = (By.XPATH,'//android.widget.TextView[@text=\"评论发表成功!\"]')
    def get_plcg(self):
        '''评论成功'''
        plcg = self.find_element(self.plcg_locator).text
        return plcg







    #验证社区点赞功能
    dzqz_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    jrdz_locator = (By.XPATH, '//android.support.v7.widget.RecyclerView[@resource-id=\"com.gfeng.daydaycook:id/recyclerView\"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.TextView[1]')
    dz_locator = (By.XPATH,'//android.widget.LinearLayout[@resource-id=\"com.gfeng.daydaycook:id/like_layout\"]')

    def dzqz(self):
        self.driver.find_element(*self.dzqz_locator).click()
    def jrdz(self):
        self.driver.find_element(*self.jrdz_locator).click()
    def dz(self):
        self.driver.find_element(*self.dz_locator).click()

    #断言社区点赞成功
    dzcg_locator = (By.XPATH,'//android.widget.TextView[@resource-id=\"com.gfeng.daydaycook:id/nickName_tv\"]')
    def get_dzcg(self):
        '''点赞成功'''
        dzcg = self.find_element(self.dzcg_locator).text
        return dzcg








    #验证社区收藏
    scqztj_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    scbz_locator = (By.XPATH,'//android.support.v7.widget.RecyclerView[@resource-id=\"com.gfeng.daydaycook:id/recyclerView\"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.TextView[1]')
    scqd_locator = (By.XPATH,'//android.widget.LinearLayout[@resource-id=\"com.gfeng.daydaycook:id/ll_collection\"]')

    def scqztj(self):
        self.driver.find_element(*self.scqztj_locator).click()
    def scbz(self):
        self.driver.find_element(*self.scbz_locator).click()
    def scqd(self):
        self.driver.find_element(*self.scqd_locator).click()

    #断言社区收藏成功
    sccg_locator = (By.XPATH,'//android.widget.TextView[@resource-id=\"com.gfeng.daydaycook:id/tv_seen_desc\"]')
    def get_sccg(self):
        '''收藏成功'''
        sccg = self.find_element(self.sccg_locator).text
        return sccg








    #验证关注博主功能
    gzbz_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    gzbzqz_locator = (By.XPATH,'//android.support.v7.widget.RecyclerView[@resource-id=\"com.gfeng.daydaycook:id/recyclerView\"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.TextView[1]')
    bzgz_locator = (By.XPATH,'//android.widget.ImageView[@resource-id=\"com.gfeng.daydaycook:id/iv_focus_status\"]')

    def gzbz(self):
        self.driver.find_element(*self.gzbz_locator).click()
    def gzbzqz(self):
        self.driver.find_element(*self.gzbzqz_locator).click()
    def bzgz(self):
        self.driver.find_element(*self.bzgz_locator).click()

    #断言关注博主成功
    shequgzcg_locator = (By.XPATH,'//android.widget.TextView[@text=\"关注\"]')
    def get_shequgzcg(self):
        '''关注博主成功'''
        shequgzcg = self.find_element(self.shequgzcg_locator).text
        return shequgzcg







    #验证社区查看热门煮厨功能
    ckrm_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    rmck_locator = (By.XPATH,'//android.support.v7.widget.RecyclerView[@resource-id=\"com.gfeng.daydaycook:id/recyclerViewUser\"]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]')

    def ckrm(self):
        self.driver.find_element(*self.ckrm_locator).click()
    def rmck(self):
        self.driver.find_element(*self.rmck_locator).click()

    #断言社区热门查看成功
    rmckcg_locator = (By.XPATH,'//android.widget.TextView[@text=\"热门煮厨\"]')
    def get_rmckcg(self):
        '''热门查看成功'''
        rmckcg = self.find_element(self.rmckcg_locator).text
        return rmckcg



    #验证取消关注博主功能
    qxgzbz_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    qxgzbzqz_locator = (By.XPATH,'//android.support.v7.widget.RecyclerView[@resource-id=\"com.gfeng.daydaycook:id/recyclerView\"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.ImageView[1]')
    qxgzbzqd_locator = (By.XPATH,'//android.widget.ImageView[@resource-id=\"com.gfeng.daydaycook:id/iv_focus_status\"]')

    def qxgzbz(self):
        self.driver.find_element(*self.qxgzbz_locator).click()
    def qxgzbzqz(self):
        self.driver.find_element(*self.qxgzbzqz_locator).click()
    def qxgzbzqd(self):
        self.driver.find_element(*self.qxgzbzqd_locator).click()

    #断言取消关注成功
    sqqxgz_locator = (By.XPATH,'//android.widget.TextView[@text=\"关注\"]')
    def get_sqqxgz(self):
        '''取消关注成功'''
        sqqxgz = self.find_element(self.sqqxgz_locator).text
        return sqqxgz




    #验证社区搜索功能
    sqss_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    ssan_locator = (By.XPATH,'//android.widget.ImageView[@resource-id=\"com.gfeng.daydaycook:id/searchIv\"]')
    ssqd_locator = (By.ID,'com.gfeng.daydaycook:id/wordTv')

    def sqss(self):
        self.driver.find_element(*self.sqss_locator).click()
    def ssan(self):
        self.driver.find_element(*self.ssan_locator).click()
    def ssqd(self):
        self.driver.find_element(*self.ssqd_locator).click()

    #断言搜索成功
    sscg_locator = (By.XPATH,'//android.widget.TextView[@text=\"热门搜索\"]')
    def get_sscg(self):
        '''搜索成功'''
        sscg = self.find_element(self.sscg_locator).text
        return sscg




    #验证取消点赞和收藏功能
    qxdzsc_locator = (By.XPATH,'//android.widget.TabWidget[@resource-id=\"android:id/tabs\"]/android.widget.RelativeLayout[2]')
    qxdzscjr_locator = (By.XPATH,'//android.support.v7.widget.RecyclerView[@resource-id=\"com.gfeng.daydaycook:id/recyclerView\"]/android.widget.RelativeLayout[1]/android.widget.RelativeLayout[1]/android.widget.LinearLayout[1]/android.widget.RelativeLayout[1]/android.widget.TextView[1]')
    qxdzscone_locator = (By.XPATH,'//android.widget.LinearLayout[@resource-id=\"com.gfeng.daydaycook:id/like_layout\"]')
    qxdzsctwo_locator = (By.XPATH,'//android.widget.LinearLayout[@resource-id=\"com.gfeng.daydaycook:id/ll_collection\"]')

    def qxdzsc(self):
        self.driver.find_element(*self.qxdzsc_locator).click()
    def qxdzscjr(self):
        self.driver.find_element(*self.qxdzscjr_locator).click()
    def qxdzscone(self):
        self.driver.find_element(*self.qxdzscone_locator).click()
    def qxdzsctwo(self):
        self.driver.find_element(*self.qxdzsctwo_locator).click()

    #断言取消成功
    qxcgqb_locator = (By.XPATH,'//android.widget.TextView[@resource-id=\"com.gfeng.daydaycook:id/nickName_tv\"]')
    def get_qxcgqd(self):
        '''取消成功'''
        qxcgqb = self.find_element(self.qxcgqb_locator).text
        return qxcgqb
















